import request from "@/utils/request";
import { useAppStore } from '@/store/modules/app'
const appStore = useAppStore()

// 查询
export function findOrgTree() {
  return request({
    url: `/base/orgDict/findTree?type=${appStore.sidebar.model}`,
    method: "get",
  });
}
// 查询县下机构
export function findDescendant(id) {
  return request({
    url: `/base/orgDict/findDescendant/${id}?type=${appStore.sidebar.model}`,
    method: "get",
  });
}
// add
export function orgAdd(data) {
  return request({
    url: `/base/orgDict/save?type=${appStore.sidebar.model}`,
    method: "post",
    data
  });
}
// info
export function orgInfo(id) {
  return request({
    url: `/base/orgDict/${id}?type=${appStore.sidebar.model}`,
    method: "get",
  });
}
// delete
export function orgDelete(id) {
  return request({
    url: `/base/orgDict/${id}?type=${appStore.sidebar.model}`,
    method: "delete",
  });
}

export function getAllTableName() {
  return request({
    url: `/base/orgDict/getAllTableName/${appStore.sidebar.model}`,
    method: "get",
  });
}
